<?php
/**
 * 用户消息内容处理
 */

class mod_user_message {
	
	//获取内容中@的信息
	function get_at_user_by_text($text)
	{
		preg_match_all("/@([\x{4e00}-\x{9fa5}0-9A-Za-z_\-]+)/u",$text,$match);
		return $match[1];
	}
	
	
	function add_at_info_by_type($content,$from_uid,$from_id,$at_type)
	{
		$at_uids = $this->get_at_user_by_text($content);
		$db_at_info = new db_at_info();
		$db_user_info = new db_user_info();
		if(!$at_uids)
		{
			return  false;
		}
		$user_list = $db_user_info->get_user_list_by_names($at_uids);
		foreach($user_list as $key => $value)
		{
			$to_uid = $value["uid"];
			$db_at_info->insert_at_info($from_uid,$to_uid,$from_id,$at_type);
			
		}
	
		
	}
	
	
	
}
	